<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>修改文档 - CoCo后台管理系统</title>
<link rel="icon" href="favicon.ico" type="__STATIC__/admin/img/ico">
<meta name="author" content="yinqi">
<link href="__STATIC__/admin/css/bootstrap.min.css" rel="stylesheet">
<link href="__STATIC__/admin/css/materialdesignicons.min.css" rel="stylesheet">
<!--标签插件-->
<link rel="stylesheet" href="__STATIC__/admin/js/jquery-tags-input/jquery.tagsinput.min.css">
<link href="__STATIC__/admin/css/style.min.css" rel="stylesheet">
</head>
  
<body>
<div class="lyear-layout-web">
  <div class="lyear-layout-container">
    
    <!--左侧导航-->
    {include file="../application/admin/view/common/left.html"}
    <!--End 左侧导航-->
    
    <!--头部信息-->
    {include file="../application/admin/view/common/header.html"}
    <!--End 头部信息-->
    
    <!--页面主要内容-->
    <main class="lyear-layout-content">
      
      <div class="container-fluid">
        
        <div class="row">
          <div class="col-lg-12">
            <div class="card">
              <div class="card-body">
                
                <form action="/admin/food/modify_food_action" method="post" class="row" enctype="multipart/form-data">
                  <input type="hidden" name="food_id" value="{$food_info.food_id}">
                  <div class="form-group col-md-12">
                    <label for="name">餐品名称</label>
                    <input type="text" class="form-control" id="name" name="name" value="{$food_info.name}" placeholder="请输入餐品名称" />
                  </div>
                  <div class="form-group col-md-12">
                    <label for="price">餐品价格</label>
                    <input type="text" class="form-control" id="price" name="price" value="{$food_info.price}" placeholder="请输入餐品价格" />
                  </div>
                  <div class="form-group col-md-12">
                    <label for="stock">餐品库存</label>
                    <input type="text" class="form-control" id="stock" name="stock" value="{$food_info.stock}" placeholder="请输入餐品库存" />
                  </div>
                  <div class="form-group col-md-12">
                    <label for="type">餐品类型</label>
                    <div class="form-controls">
                      <select name="type" class="form-control" id="type">
                        <option value="{$food_info.type}">{$food_info.type}</option>
                        {volist name="type_list" id="type"}
                        <option value="{$type.type_name}">{$type.type_name}</option>
                        {/volist}
                      </select>
                    </div>
                  </div>
                  <div class="form-group col-md-12">
                    <label>图片上传</label>
                    <div class="form-controls">
                      <ul class="list-inline clearfix lyear-uploads-pic">
                        <li class="col-xs-4 col-sm-3 col-md-2">
                          <a class="pic-add" id="add-pic-btn" title="点击上传" style="position: relative">
                            <img id="img" style="width: 240px;height:240px;" src="{$food_info.img}">
                            <input type="file" onchange="upLoad();" id="food_img" name="food_img" style="opacity: 0;position: absolute;left:0;width: 254px;height:254px;" /></a>
                        </li>
                      </ul>
                    </div>
                  </div>
                  <div class="form-group col-md-12">
                    <button type="submit" class="btn btn-primary ajax-post" target-form="add-form">确 定</button>
                    <button type="button" class="btn btn-default" onclick="javascript:history.back(-1);return false;">返 回</button>
                  </div>
                </form>
       
              </div>
            </div>
          </div>
          
        </div>
        
      </div>
      
    </main>
    <!--End 页面主要内容-->
  </div>
</div>

<script type="text/javascript" src="__STATIC__/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/bootstrap.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/perfect-scrollbar.min.js"></script>
<!--标签插件-->
<script src="__STATIC__/admin/js/jquery-tags-input/jquery.tagsinput.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/main.min.js"></script>
<script>
  function upLoad(){
        var fileInput = document.getElementById("food_img");
        var file = fileInput.files[0];
        //创建读取文件的对象
        var reader = new FileReader();         
        //创建文件读取相关的变量
        var imgFile;         
        //为文件读取成功设置事件
        reader.onload=function(e) {
            // alert('文件读取完成');
            imgFile = e.target.result;
            $("#img").attr('src',imgFile);
        };
 
        //正式读取文件
        reader.readAsDataURL(file);
    }
</script>
</body>
</html>